def max_sum(arr):
    largest = 0
    b = 0
    for i in arr:
        if b > 0:
            b += i
        else:
            b = i
        if b > largest:
            largest = b
    return largest

if __name__ == '__main__':
    print(max_sum([-2, 11, -4, 13, -5, -2]))

